import gtk
import database

class appDatabase:
    """database manage application class"""
    def __init__(self):
        builder = gtk.Builder()
        builder.add_from_file("ui/database.glade")
        self._dialog = builder.get_object("databaseSettingsDialog")
        statusLabel = builder.get_object("statusLabel")
        db = database.getMyDatabase()
        statusLabel.set_text("Database size : %d o\n%d writings"%(db.getStatus()["size"],db.getStatus()["nbRow"]))
        builder.connect_signals(self)   
            
    def on_okButton_clicked(self,widget,data=None):
        self._dialog.destroy()
        
    def on_cancelButton_clicked(self,widget,data=None):
        self._dialog.destroy()
    
    def on_delDbAction_activate(self,widget,data=None):
        database.createDatabase()
 
